function [ T1,T2,T3,T4 ] = Wavelet(iclass, jth, key, width, height)    
%     I = imread(strcat('D:\Faces\ORL',num2str(key),'\s',num2str(iclass),'\',num2str(jth),'.bmp'));
%     I = imread(strcat('D:\Faces\YALE', num2str(key),'\s',num2str((iclass - 1) * 11 + jth),'.bmp'));
	I = imread(strcat('D:\Faces\JAFFE', num2str(key),'\s',num2str(iclass),'\',num2str(jth),'.bmp'));
    [c1,s1]=wavedec2(double(I),1,'db1');
    ca = appcoef2(c1,s1,'db1',1);
    [c2,s2] = wavedec2(double(ca),1,'db1');
    ba = appcoef2(c2,s2,'db1',1);
    [c3,s3] = wavedec2(double(ba),1,'db1');
    a = appcoef2(c3,s3,'db1',1);
    h = detcoef2('h',c3,s3,1);
    v = detcoef2('v',c3,s3,1);
    d = detcoef2('d',c3,s3,1);
    
    T1 = a(1,:);
    for i = 2:height
        T1 = cat(2, T1, a(i,:));
    end    
    T2 = h(1,:);
    for i = 2:height
        T2 = cat(2, T2, h(i,:));
    end    
    T3 = v(1,:);
    for i = 2:height
        T3 = cat(2, T3, v(i,:));
    end
    T4 = d(1,:);
    for i = 2:height
        T4 = cat(2, T4, d(i,:));
    end
end

